<template>
    <el-container style="height: 500px; border: 1px solid #eee">
        <!--        <el-header style="text-align: right; font-size: 12px" height="50px">-->
        <el-header style="text-align: right; font-size: 12px">

            <el-row :gutter="20">
                <el-col :span="4" style="text-align: center">
                    <div class="grid-content bg-purple">
                        <el-image :src="logo" fit="fill" style="width: 80px; height: 50px; margin-top: 5px">logo
                        </el-image>
                    </div>
                </el-col>
                <!--填充布局-->
                <el-col :span="12">
                    <div class="grid-content bg-purple">&nbsp;</div>
                </el-col>
                <el-col :span="8">
                    <div class="grid-content bg-purple" style=" margin-right: 5vw">
                        <!--账号信息-->
                        <el-dropdown>
                            <i class="el-icon-setting" style="margin-right: 30px"></i>
                            <el-dropdown-menu slot="dropdown" style="width: 200px; text-align: center">
                                <el-dropdown-item>
                                    <router-link :to="{name:'UserCenter'}">
                                        <div style="color: #0c0c0c"><span>个人中心</span></div>
                                    </router-link>
                                </el-dropdown-item>
                                <el-dropdown-item>
                                    <router-link :to="{name:'RePassWord'}">
                                        <div style="color: #0c0c0c"><span>修改密码</span></div>
                                    </router-link>
                                </el-dropdown-item>
                                <el-dropdown-item>
                                    <router-link to="/">
                                        <div style="color: #0c0c0c"><span>退出登录</span></div>
                                    </router-link>
                                </el-dropdown-item>
                            </el-dropdown-menu>
                        </el-dropdown>
                        <el-avatar src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"></el-avatar>
<!--                        <div class="header-avatar"></div>-->
                        <span>王小虎</span>
                    </div>
                </el-col>
            </el-row>
        </el-header>

        <el-container>
            <el-aside style="background-color: rgb(238, 241, 246)">
                <!--
                      <el-menu :default-openeds="['1', '3']">
                        <el-submenu index="1">
                          <template slot="title"><i class="el-icon-message"></i>发送邮件</template>
                          <el-menu-item-group>
                            <template slot="title">分组一</template>
                            <el-menu-item index="1-1">选项1</el-menu-item>
                            <el-menu-item index="1-2">选项2</el-menu-item>
                          </el-menu-item-group>
                          <el-menu-item-group title="分组2">
                            <el-menu-item index="1-3">选项3</el-menu-item>
                          </el-menu-item-group>
                          <el-submenu index="1-4">
                            <template slot="title">选项4</template>
                            <el-menu-item index="1-4-1">选项4-1</el-menu-item>
                          </el-submenu>
                        </el-submenu>
                        <el-submenu index="2">
                          <template slot="title"><i class="el-icon-menu"></i>接收邮箱</template>
                          <el-menu-item-group>
                            <template slot="title">分组一</template>
                            <el-menu-item index="2-1">选项1</el-menu-item>
                            <el-menu-item index="2-2">选项2</el-menu-item>
                          </el-menu-item-group>
                          <el-menu-item-group title="分组2">
                            <el-menu-item index="2-3">选项3</el-menu-item>
                          </el-menu-item-group>
                          <el-submenu index="2-4">
                            <template slot="title">选项4</template>
                            <el-menu-item index="2-4-1">选项4-1</el-menu-item>
                          </el-submenu>
                        </el-submenu>
                        <el-submenu index="3">
                          <template slot="title"><i class="el-icon-setting"></i>通讯录</template>
                          <el-menu-item-group>
                            <template slot="title">分组一</template>
                            <el-menu-item index="3-1">选项1</el-menu-item>
                            <el-menu-item index="3-2">选项2</el-menu-item>
                          </el-menu-item-group>
                          <el-menu-item-group title="分组2">
                            <el-menu-item index="3-3">选项3</el-menu-item>
                          </el-menu-item-group>
                          <el-submenu index="3-4">
                            <template slot="title">选项4</template>
                            <el-menu-item index="3-4-1">选项4-1</el-menu-item>
                          </el-submenu>
                        </el-submenu>
                      </el-menu>
                -->

                <el-menu
                    default-active="1"
                    class="el-menu-vertical-demo"
                    @open="handleOpen"
                    @close="handleClose"
                    background-color="#545c64"
                    text-color="#fff"
                    active-text-color="#ffd04b"
                    :collapse="false"
                >
                    <el-menu-item index="1" width="200px">
                        <router-link :to="{name:'MailWrite'}">
                            <div><i class="el-icon-menu"></i><span>发送邮箱</span></div>
                        </router-link>
                    </el-menu-item>
                    <!--
                                        <el-menu-item index="2" width="200px">
                                            <router-link :to="{name:'ContactList'}">
                                                <div><i class="el-icon-document"></i><span>接收邮箱</span></div>
                                            </router-link>
                                        </el-menu-item>
                    -->
                    <el-menu-item index="3">
                        <router-link :to="{name:'ContactList'}">
                            <div><i class="el-icon-setting"></i><span>通讯录</span></div>
                        </router-link>
                    </el-menu-item>
                    <el-menu-item index="4">
                        <router-link :to="{name:'LogList'}">
                            <div><i class="el-icon-setting"></i><span>日志管理</span></div>
                        </router-link>
                    </el-menu-item>
                    <el-menu-item index="5">
                        <router-link :to="{name:'menuList'}">
                            <div><i class="el-icon-setting"></i><span>系统管理【可选】</span></div>
                        </router-link>
                    </el-menu-item>
                    <el-menu-item index="6" v-if="true">
                        <router-link :to="{name:'UserList'}">
                            <div><i class="el-icon-setting"></i><span>用户管理【管理员设置】</span></div>
                        </router-link>
                    </el-menu-item>
                    <!--
                                        <el-menu-item index="7">
                                            <router-link :to="{name:'menuList'}">
                                                <div><i class="el-icon-setting"></i><span>草稿箱【待定】</span></div>
                                            </router-link>
                                        </el-menu-item>
                    -->
                    <!--
                                        <el-submenu index="8">
                                            <template slot="title">
                                                <i class="el-icon-location"></i>
                                                <span>导航一</span>
                                            </template>
                                            <el-menu-item-group>
                                                <template slot="title">分组一</template>
                                                <el-menu-item index="1-1">选项1</el-menu-item>
                                                <el-menu-item index="1-2">选项2</el-menu-item>
                                            </el-menu-item-group>
                                            <el-menu-item-group title="分组2">
                                                <el-menu-item index="1-3">选项3</el-menu-item>
                                            </el-menu-item-group>
                                            <el-submenu index="1-4">
                                                <template slot="title">选项4</template>
                                                <el-menu-item index="1-4-1">选项1</el-menu-item>
                                            </el-submenu>
                                        </el-submenu>
                    -->
                </el-menu>
            </el-aside>
            <el-main>
                <!--主体内容-->
                <!-- 路由匹配到的组件将显示在这里 -->
                <router-view></router-view>
            </el-main>
        </el-container>
    </el-container>
</template>

<script>
export default {
    name: "AppLayout",
    data() {
        const item = {
            date: '2016-05-02',
            name: '王小虎',
            address: '上海市普陀区金沙江路 1518 弄'
        };
        return {
            circleUrl: '',
            tableData: Array(20).fill(item),
            logo: require('@/assets/logo.png') // 后台管理系统LOGO。
        }
    },
    methods: {
        handleOpen(key, keyPath) {
            console.log(key, keyPath);
        },
        handleClose(key, keyPath) {
            console.log(key, keyPath);
        },
        handleDemo(key, keyPath) {
            console.log(key, keyPath);
        }
    }
};
</script>

<style scoped>

.el-header {
    background-color: #B3C0D1;
    color: #333;
    line-height: 60px;
}

.header-avatar {
    display: inline-block;
}

.el-avatar {

}

.el-aside {
    color: #333;
}

.el-menu-vertical-demo:not(.el-menu--collapse) {
    width: 20vw;
    /*min-height: 400px;*/
    height: calc(100vh - 60px);
}

a {
    text-decoration: none;
    color: #0c0c0c;
}

.router-link-active {
    text-decoration: none;
    color: #fff;
}

.router-link-active div {
    display: inline-block;
}
</style>